package b_state.b_design_patten;

/**
 * Created by wug on 2016/6/14 0014.
 */
public class WaterMachine {
    private State state;
    private int num;
    private int money;

    public WaterMachine() {
        this.state = new StateSoldOut(this);
        num = 0;
        money = 0;
    }


    /**
     * 工人上货
     */
    public void put() {
        state.workerPut();
    }

    /**
     * 投钱
     * @param num
     */
    public void insert(int num) {
        state.insertMoney(num);
    }

    /**
     * 售水按钮被按下
     */
    public void sell() {
        state.pressSellBtn();
    }

    /**
     * 退钱按钮被按下
     */
    public void retun() {
        state.refundRocker();
    }


    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }
}
